package fileProcessors.implementations;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import fileProcessors.FileFormatException;
import fileProcessors.FileProcessor;

public class RegexLineKiller extends FileProcessor {
	
	
	
	@Override
	public void processFiles(File files[], File currentDirectory, File outputFile) throws FileFormatException {
		for(int i=0; i<files.length; i++){
			try {
				BufferedReader br=new BufferedReader(new FileReader(files[i]));
				BufferedWriter bw=new BufferedWriter(new FileWriter(files[i].getName()+"corrected.txt"));
				for(String line=br.readLine();line!=null;line=br.readLine()){
					Pattern checkRegex=Pattern.compile("[����]");
					Matcher regexmatcher=checkRegex.matcher(line);
					if(regexmatcher.find()){
						System.out.println(line);
						continue;
					}
					else{
						bw.write(line);
						bw.newLine();
					}
				}
				br.close();
				bw.close();
			} catch (IOException e) {
				
			}
		}
	}

	@Override
	public String getInformation() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public String getDate() {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean contains(String regex, String string2check){
		
		
		
		return false;
	}
}
